home *** CD-ROM | disk | FTP | other *** search
- /********************************************************************************/
- /* */
- /* FileTest.c - A/ROSE file system test. (Dynamic Task) */
- /* */
- /* Richard W. Mincher. December 20, 1989. */
- /* */
- /* Modified by Anumele D. Raja on June 17, 1991 */
- /* Changed all the names of file manager calls with A in the front */
- /* */
- /* Copyright © 1989-1991 Apple Computer, Inc. All rights reserved. */
- /* */
- /********************************************************************************/
-
- /*
- This program operates on a file named FS.Test.
-
- First it deletes the file, creates a new file, and opens it.
- Then 1200 bytes are written into this file.
- Next the file is posited at offset 13 and it tries to read 1000 bytes
- in a loop till it gets an EOF error
- */
-
- #include "Arose.h"
- #include "Managers.h"
-
- #include "FileTask.h"
-
- #define NOISE
-
- char buffer[1001];
-
- main()
- {
- unsigned short ix;
- short stat;
- long count;
- short fid;
-
- stat = AFSDelete( "FS.Test", 0 );
- #ifdef NOISE
- printf("Delete received. Result = %d\n", stat );
- #endif NOISE
-
- stat = ACreate( "FS.Test", 0, 'MPS ', 'TEXT' );
- #ifdef NOISE
- printf("Create received. Result = %d\n", stat );
- #endif NOISE
-
- stat = AFSOpen( "FS.Test", 0, &fid );
- #ifdef NOISE
- printf("Open received. Result = %d\n", stat );
- #endif NOISE
-
- for(ix=0; ix < 100; ix++)
- {
- count = 12;
- stat = AFSWrite( fid, &count, "0123456789A\n" );
- #ifdef NOISE
- printf("Write received. Result = %d\n", stat );
- #endif NOISE
- }
-
- stat = ASetFPos( fid, 1, 13 );
- #ifdef NOISE
- printf("SetFPos received. Result = %d\n", stat );
- #endif NOISE
-
-
- stat = 0;
- while(!stat)
- {
- count = 1000;
- stat = AFSRead( fid, &count, buffer );
- #ifdef NOISE
- printf("Read received. Result = %d Count = %d\n", stat, count );
- #endif NOISE
- }
-
- stat = AFSClose( fid );
- #ifdef NOISE
- printf("Close received. Result = %d\n", stat );
- #endif NOISE
-
- }